package test3;

public class Student {
    private String sid;
    private String name;
    private int age;
    private String major;

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age<0){
            return;
        }else{
            this.age=age;
        }
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public Student(){
        this.sid=sid;
        this.name=name;
        setAge(age);
        this.major=major;
    }

    public Student(String sid,String name,int age,String major){
        this.sid=sid;
        this.name=name;
        setAge(age);
        this.major=major;
    }

    public void print(){
        System.out.println("学号："+sid+"，姓名："+name+"，年龄："+age+"，专业："+major);
    }
}
